﻿#define Expection
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Xml;
using UmcProvider.Controls;
using UmcProvider;
using System.Design;
using System.Reflection;

namespace ChinaTelecom.SmartPhone.Controls
{
#if Expection   //if reserve mode
    //Add the properties expected to be reserved
    public interface IRescoAdvancedListExpection : IUmc
    {
        string Name { get; }
        bool Enabled { get; }
        bool Visible { get; }
        Size Size { get; }
        Point Location { get; }
        Color BackColor { get; }
        bool AutoScroll { get; }
        bool AutoBinding { get; }
        bool TouchScrolling { get; }
        bool MultiSelect { get; }
        Color ForeColor { get; }

    }
    public interface IRescoAdvancedList : IRescoAdvancedListExtension, IRescoAdvancedListExpection { }
    [Designer(typeof(UmcDesigner<IRescoAdvancedList>))]
#else                 //if exclude mode
    //Add the Properties to be excluded here
    [ExcludeProperty]
    public interface IRescoAdvancedListExculde :  IUmc
    {
        bool Enabled { get; }
        Size Size { get; }
        Color BackColor { get; }
        Font Font { get; }
        Color ForeColor { get; }
    }
    public interface IRescoAdvancedList : IRescoAdvancedListExtension, IRescoAdvancedListExculde { }
    [Designer(typeof(UmcDesigner<RescoAdvancedList>))]
#endif
    [ToolboxBitmap(typeof(Resco.Controls.AdvancedList.AdvancedList), "AdvancedList.bmp")]
    public sealed class RescoAdvancedList : Resco.Controls.AdvancedList.AdvancedList, IRescoAdvancedList
    {
    }

    //Add Extension Properties here , and Implement in Inheritance class
    public interface IRescoAdvancedListExtension
    {

    }

    public sealed class UmcRescoAdvancedList : DefaultConverter<UmcRescoAdvancedList, RescoAdvancedList>, IRescoAdvancedList
    {
        //public override XmlNode[] Serialize(System.ComponentModel.IComponent root, XmlDocument document)
        //{
        //    XmlNode[] nodes = base.Serialize(root, document);

        //    if (nodes.Length > 0)
        //    {
        //        XmlNode advancedListNode = nodes[0];
        //        RescoAdvancedList advancedList = root as RescoAdvancedList;
        //        if (advancedList != null)
        //        {
        //            Resco.Controls.AdvancedList.HeaderRow headerRow = advancedList.HeaderRow;
        //            XmlNode headerRowNode = document.CreateNode(XmlNodeType.Element, "HeaderRow", null);
        //            headerRowNode.Attributes.Append(document.CreateAttribute("TemplateIndex")).Value = headerRow.TemplateIndex.ToString();
        //        }
        //    }

        //    return nodes;
        //}

        //public override IComponent DeSerialize(IDesignerHost host, XmlDocument document, XmlNode[] node)
        //{
        //    IComponent component = base.DeSerialize(host, document, node);
        //    RescoAdvancedList advancedList = component as RescoAdvancedList;

        //    if (node.Length > 0 && advancedList != null)
        //    {
        //        XmlNode advancedListNode = node[0];
        //        foreach (XmlNode childNode in advancedListNode.ChildNodes)
        //        {
        //            if (childNode.NodeType == XmlNodeType.Element && childNode.Name == "HeaderRow")
        //            {
        //                Resco.Controls.AdvancedList.HeaderRow headerRow = new Resco.Controls.AdvancedList.HeaderRow();
        //                if (!string.IsNullOrEmpty(childNode.Attributes["TemplateIndex"].Value))
        //                {
        //                    PropertyInfo prop = typeof(Resco.Controls.AdvancedList.HeaderRow).GetProperty("TemplateIndex");
        //                    prop.SetValue(headerRow, childNode.Attributes["TemplateIndex"].Value, null);
        //                }
        //                break;
        //            }
        //        }
        //    }

        //    return component;
        //}

        #region Hidden
        public string Name
        {
            get { throw new NotImplementedException(); }
        }

        public bool Enabled
        {
            get { throw new NotImplementedException(); }
        }

        public bool Visible
        {
            get { throw new NotImplementedException(); }
        }

        public System.Drawing.Size Size
        {
            get { throw new NotImplementedException(); }
        }

        public System.Drawing.Point Location
        {
            get { throw new NotImplementedException(); }
        }

        public System.Drawing.Color BackColor
        {
            get { throw new NotImplementedException(); }
        }

        public bool AutoScroll
        {
            get { throw new NotImplementedException(); }
        }

        public bool AutoBinding
        {
            get { throw new NotImplementedException(); }
        }

        public bool TouchScrolling
        {
            get { throw new NotImplementedException(); }
        }

        public bool MultiSelect
        {
            get { throw new NotImplementedException(); }
        }

        public System.Drawing.Color ForeColor
        {
            get { throw new NotImplementedException(); }
        }
        #endregion
    }
}